using Aurora.AI.Abstractions;

namespace Gateway.UI.Api.Controllers.Ai;

/// <summary>
/// ai 模型 控制器
/// </summary>
[ApiController]
[Route("api/ai/gateway/model")]
public class AiModelController : BaseController
{
    /// <summary>
    /// 获取模型支持列表
    /// </summary>
    /// <returns></returns>
    [HttpGet("list")]
    public Task<List<object>> GetModels(string platform)
    {
        List<object> result = new List<object>();
        foreach (var item in AuroraAIGlobal.ModelNames)
        {
            if (!string.IsNullOrEmpty(platform))
            {
                if (!item.Key.Equals(platform))
                {
                    continue;
                }
            }
            KeyValuePair<string, string>? firstOrDefault = AuroraAIGlobal.PlatformNames.FirstOrDefault(x=> x.Value.Equals(item.Key));
            string name = string.Empty;
            if (firstOrDefault!=null)
            {
                name = firstOrDefault.Value.Key;
            }
            result.Add(new
            {
                code = item.Key,
                name = name,
                models = item.Value
            });
        }
        return Task.FromResult(result);
    }
    // 添加
    // 编辑
    // 删除
    // 列表
    // 详情
}